﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8"%>
<%@include file="/common/taglibs.jsp"%>
<%@include file="/common/javascript.jsp" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>同意核可</title>
    <script type="text/javascript">
    var mainform;
    var viewType = "${viewType}";
	var dialog=null;
	var terDialog=null;
	
    $(function (){
    
    	//$("#dateF").ligerDateEditor();
    	
    	//$("#dateT").ligerDateEditor();
    	
        mainform=$("#mainform");
        
        mainform.ligerForm();
        
        //如果是修改视图,主键不可编辑
        if(viewType=="modify"){
        	 $("#id").attr("readonly", "readonly").removeAttr("validate");
        }
        
        //如果是详细试图,所有字段不可编辑
        if(viewType=="detail"){
        	$("input,select,textarea",mainform).attr("readonly", "readonly");
        }else{
            $.metadata.setType("attr", "validate");
            LG.validate(mainform);
        }
        
        //渲染按钮
        //LG.setFormDefaultBtn(cancel,viewType=="detail" ? null : save);
        
        //调整form-bar
        //$(".form-bar").css("width","800px");   
        var buttons=new Array();
        buttons.push({ text: '取消', onclick: callBackCancel });
        //buttons.push({ text: '拒绝', onclick: doReject });
        buttons.push({ text: '同意', onclick: doAgree });
        LG.addFormButtons(buttons);
        $(".form-bar").css("width","600px");
    });
   
    function callBackCancel(){
        var win = window.parent || window;
        if(win.dialog){
        	win.dialog.close();
        }
    }
    
    
    function doAgree(){
        LG.submitForm(mainform, function (result) {
        	if(typeof(result)=="string"){
        		result=eval("("+result+")");
        	}
            if (!result.success) {
                LG.showError('错误:' + result.message);
            }
            else { 
                LG.showSuccess('核可成功', function () { 
                   LG.callParent("courseRegisterAuthList");
                });
            }
        });
    }
 </script>
</head>

<body>
    <form name="mainform" method="post"  id="mainform" action="${ctx}/qso/courseRegister/doAgree">
        <input type="hidden" id="id" name="id" value="${command.id}"/>
        <input type="hidden" id="authType" name="authType" value="${authType}"/>
        <input type="hidden" id="courseId" name="courseId" value="${command.course.id}"/>
        <input type="hidden" id="stuId" name="stuId" value="${command.student.stuId}"/>
        <input type="hidden" id="terId" name="terId" value="${command.teacher.terId}"/>
        <input type="hidden" id="crStatus" name="crStatus" value="${command.crStatus}" />
        <table cellpadding="0" cellspacing="0" class="l-table-edit" style="width: 95%; margin-top:10px; margin-left:15px;">     
            <tr>
                <td align="right" class="l-table-edit-td">申请单编号:</td>
                <td align="left" class="l-table-edit-td" >
						${command.id}
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">课程名称:</td>
                <td align="left" class="l-table-edit-td" >
                	<input  type="text"  readonly="readonly"  id="courseName" name="courseName" value="${command.course.title}"/>
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">老师名称:</td>
                <td align="left" class="l-table-edit-td" >
                	<input  type="text" readonly="readonly" id="terName" name="terName" value="${command.teacher.terName}"/>
                </td>
            </tr>
            <tr>
            	<td align="right"  class="l-table-edit-td">申请意见:</td>
                <td align="left" class="l-table-edit-td" colspan="4">
                	<textarea cols="200" rows="3" class="l-textarea" id="crMessage" name="crMessage" style="width:400px" <c:if test="${viewType=='detail'}">disabled="disabled"</c:if> >${command.crMessage}</textarea>
                </td>
            </tr>
        </table> 
    </form>
</body>
</html>